package com.lp.controller.iot;

import com.lp.bo.IotSceneInfoBO;
import com.lp.bo.UserInfoBO;
import com.lp.controller.BaseController;
import com.lp.util.ObjectUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author thomas.he
 * @Description:
 * @date 2021/7/27 21:39
 */
@Controller
public class IotVisualViewController extends BaseController
{
    private static final String VIEW_PATH = "/oss/iot/";

    @RequestMapping(method={org.springframework.web.bind.annotation.RequestMethod.GET}, value={"/iot/visual_manager"})
    public ModelAndView monitorPage(HttpServletRequest req, HttpServletResponse resp, @RequestParam(required=false) Integer id)
    {
        Map resultData = getResultMap();
        try {
            if (ObjectUtil.isNotEmpty(id).booleanValue()) {
                req.setAttribute("id", id);
            }
            UserInfoBO user = getUserInfoBySession(req);
            IotSceneInfoBO obj = new IotSceneInfoBO();
            obj.setUser_id(user.getId());
            resultData = this.service.selectPageList("IotSceneInfo.select", getPageBean(Integer.valueOf(1), Integer.valueOf(200)), obj, new Object[0]);
        } catch (Exception e) {
            exception(e, resultData, new Object[0]);
        }
        return getModelAndView(resp, resultData, "/oss/iot/visual_manager", "info");
    }
}